﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
					xmlns:ui="clr-namespace:Kokomo"
					xmlns:l="clr-namespace:Kokomo.Controls"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<Style TargetType="{x:Type l:DocumentTabGroup}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:DocumentTabGroup}">
					<DockPanel>
						<ScrollViewer
							DockPanel.Dock="Top"
							CanContentScroll="True"
							>
							<ItemsPresenter/>
							<ScrollViewer.Template>
								<ControlTemplate TargetType="{x:Type ScrollViewer}">
									<Grid>
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto"/>
											<ColumnDefinition Width="*"/>
											<ColumnDefinition Width="Auto"/>
										</Grid.ColumnDefinitions>


										<RepeatButton
											Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
											Content="&lt;"
											Command="{x:Static ui:ScrollViewHelper.LineLeftCommand}"
											CommandParameter="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}}"
											/>
										<ScrollContentPresenter
											Grid.Column="1"
											CanContentScroll="{TemplateBinding CanContentScroll}"
											/>
										<RepeatButton
											Grid.Column="2"
											Content="&gt;"
											Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
											Command="{x:Static ui:ScrollViewHelper.LineRightCommand}"
											CommandParameter="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}}"
											/>
									</Grid>
								</ControlTemplate>
							</ScrollViewer.Template>
						</ScrollViewer>

						<Border
							Name="TopBar"
							Background="{TemplateBinding Background}"
							DockPanel.Dock="Top"
							MinWidth="6"
							MinHeight="6"
							/>

						<Border Name="PART_ContentHost" Margin="6"/>
					</DockPanel>
					<ControlTemplate.Triggers>
						<Trigger Property="HasItems" Value="False">
							<Setter TargetName="TopBar" Property="Visibility" Value="Hidden"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="ItemsPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<l:DocumentTabPanel IsItemsHost="True"/>
					<!--<StackPanel Orientation="Horizontal" IsItemsHost="True"/>-->
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:TabbedDocumentView}">
		<Setter Property="TabStyle">
			<Setter.Value>
				<Style TargetType="{x:Type l:DocumentTab}">
					<Setter Property="Content" Value="{Binding Item}"/>
					<Setter Property="Header" Value="{Binding}"/>
					<Setter Property="IsSelected" Value="{Binding IsSelectedWithinGroup}"/>
				</Style>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:TabbedDocumentView}">
					<l:SplitControl
						ItemsSource="{Binding Groups, RelativeSource={x:Static RelativeSource.TemplatedParent}}"
						/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:SplitControl}" BasedOn="{StaticResource {x:Type ItemsControl}}">
		<Setter Property="ItemsPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<l:SplitPanel/>
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:SplitPanel}">
	</Style>

	<Style TargetType="{x:Type l:DocumentTab}">
		<Setter Property="Background" Value="White"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:DocumentTab}">
					<Grid>
						<Grid x:Name="TabPart">
							<Grid.ColumnDefinitions>
								<ColumnDefinition/>
								<ColumnDefinition/>
								<ColumnDefinition/>
							</Grid.ColumnDefinitions>

							<Path
								Name="LeadingCurve"
								Width="6"
								Height="6"
								Data="M 0 6 A 6 6 90 0 0 6 0 V 6"
								Fill="{TemplateBinding Background}"
								VerticalAlignment="Bottom"
								HorizontalAlignment="Right"
								/>

							<Border
								Grid.Column="1"
								Padding="4"
								CornerRadius="4 4 0 0"
								Background="{TemplateBinding Background}"
								>
								<ContentPresenter
									ContentSource="Header"
									/>
							</Border>

							<Path
								Name="TrailingCurve"
								Grid.Column="2"
								Width="6"
								Height="6"
								Data="M 0 6 V 0 A 6 6 90 0 06 6"
								Fill="{TemplateBinding Background}"
								VerticalAlignment="Bottom"
								HorizontalAlignment="Left"
								/>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<!--<Setter Property="ContentTemplate" Value="{Binding ContentTemplate, RelativeSource={RelativeSource AncestorType=l:TabbedDocumentGroup}}"/>
		<Setter Property="ContentTemplateSelector" Value="{Binding ContentTemplateSelector, RelativeSource={RelativeSource AncestorType=l:TabbedDocumentGroup}}"/>
		<Setter Property="ContentStringFormat" Value="{Binding ContentStringFormat, RelativeSource={RelativeSource AncestorType=l:TabbedDocumentGroup}}"/>-->

		<Style.Triggers>
			<Trigger Property="IsSelected" Value="False">
				<Setter Property="Background" Value="Transparent"/>
				<Setter Property="Foreground" Value="White"/>
			</Trigger>
		</Style.Triggers>
	</Style>

	<Style TargetType="{x:Type l:TreemapControl}">
		<Setter Property="ItemsPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<l:TreemapPanel IsItemsHost="True"/>
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:TreemapControl}">
					<ItemsPresenter/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:TreemapItem}">
		<Setter Property="ItemsPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<l:TreemapPanel IsItemsHost="True"/>
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:TreemapItem}">
					<Grid
						Width="{TemplateBinding ActualWidth}"
						Height="{TemplateBinding ActualHeight}"
						>
						<Border
							x:Name="LeafBackground"
							Visibility="Hidden"
							>
							<Border.Background>
								<RadialGradientBrush>
									<GradientStop Offset="0" Color="LimeGreen"/>
									<GradientStop Offset="1" Color="DarkGreen"/>
								</RadialGradientBrush>
							</Border.Background>
						</Border>
						<ItemsPresenter/>
						<Viewbox
							Stretch="Uniform"
							StretchDirection="Both"
							>
							<ContentPresenter ContentSource="Header" IsHitTestVisible="False" ClipToBounds="True"/>
						</Viewbox>
					</Grid>

					<ControlTemplate.Triggers>
						<Trigger Property="IsLeaf" Value="True">
							<Setter TargetName="LeafBackground" Property="Visibility" Value="Visible"/>
						</Trigger>
						<Trigger Property="IsSelected" Value="True">
							<Setter TargetName="LeafBackground" Property="Background">
								<Setter.Value>
									<RadialGradientBrush>
										<GradientStop Offset="0" Color="Blue"/>
										<GradientStop Offset="1" Color="DarkBlue"/>
									</RadialGradientBrush>
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:TreeGraphControl}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:TreeGraphControl}">
					<StackPanel
						Orientation="Horizontal"
						IsItemsHost="True"
						/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:TreeGraphNode}">
		<Setter Property="Margin" Value="3"/>
		<Setter Property="HeaderTemplate">
			<Setter.Value>
				<DataTemplate>
					<Grid>
						<Ellipse>
							<Ellipse.Fill>
								<RadialGradientBrush>
									<GradientStop Offset="0" Color="LimeGreen"/>
									<GradientStop Offset="1" Color="DarkGreen"/>
								</RadialGradientBrush>
							</Ellipse.Fill>
						</Ellipse>
						<ContentPresenter Margin="6" Content="{Binding}"/>
					</Grid>
				</DataTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:TreeGraphNode}">
					<Grid>
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto"/>
							<RowDefinition Height="Auto"/>
						</Grid.RowDefinitions>

						<ContentPresenter HorizontalAlignment="Center" ContentSource="Header"/>
						<ItemsPresenter Grid.Row="1"/>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="ItemsPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<StackPanel Orientation="Horizontal" IsItemsHost="True"/>
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:PropertyView}">
		<Setter Property="Grid.IsSharedSizeScope" Value="True"/>
		<Setter Property="Content" Value="{Binding}"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:PropertyView}">
					<ListBox
						Name="PART_PropertyListHost"
						>
						<ItemsControl.ItemsPanel>
							<ItemsPanelTemplate>
								<StackPanel
									IsItemsHost="True"
									/>
							</ItemsPanelTemplate>
						</ItemsControl.ItemsPanel>
						<ItemsControl.GroupStyle>
							<GroupStyle>
								<GroupStyle.HeaderTemplate>
									<DataTemplate DataType="GroupItem">
									</DataTemplate>
								</GroupStyle.HeaderTemplate>
								<GroupStyle.ContainerStyle>
									<Style TargetType="{x:Type GroupItem}">
										<Setter Property="Template">
											<Setter.Value>
												<ControlTemplate TargetType="{x:Type GroupItem}">
													<Expander
														Header="{Binding Name}"
														>
														<Expander.HeaderTemplate>
															<DataTemplate>
																<TextBlock
																	Text="{Binding}"
																	FontWeight="Bold"
																	Background="Silver"
																	/>
															</DataTemplate>
														</Expander.HeaderTemplate>
														<Expander.Content>
															<ItemsPresenter/>
														</Expander.Content>
														<Expander.Template>
															<ControlTemplate TargetType="{x:Type Expander}">
																<Grid>
																	<Grid.RowDefinitions>
																		<RowDefinition Height="Auto"/>
																		<RowDefinition Height="Auto"/>
																	</Grid.RowDefinitions>

																	<ContentPresenter ContentSource="Header"/>
																	<Border
																		Grid.Row="1"
																		BorderBrush="Silver"
																		BorderThickness="16 0 0 0"
																		>
																		<ContentPresenter/>
																	</Border>
																</Grid>
															</ControlTemplate>
														</Expander.Template>
													</Expander>
												</ControlTemplate>
											</Setter.Value>
										</Setter>
									</Style>
								</GroupStyle.ContainerStyle>
							</GroupStyle>
						</ItemsControl.GroupStyle>
					</ListBox>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:PropertyViewItem}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:PropertyViewItem}">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition SharedSizeGroup="Name"/>
							<ColumnDefinition SharedSizeGroup="Value"/>
						</Grid.ColumnDefinitions>

						<Border
							BorderThickness="0 0 1 1"
							BorderBrush="Silver"
							Padding="1"
							>
							<Grid>
								<ContentPresenter
									ContentSource="Header"
									Grid.Column="0"
									Margin="0 0 6 0"
									/>

								<GridSplitter Background="Transparent" Width="6"/>
							</Grid>
						</Border>

						<Border
							Grid.Column="1"
							BorderThickness="0 0 1 1"
							BorderBrush="Silver"
							Padding="1"
							>
							<ContentPresenter/>
						</Border>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:FloatingWindow}"
		   BasedOn="{StaticResource {x:Type Window}}"
		   >
	</Style>

	<Style TargetType="{x:Type l:TypedDataGrid}" BasedOn="{StaticResource {x:Type DataGrid}}">

	</Style>

	<Style TargetType="{x:Type l:ParallelScrollViewer}" BasedOn="{StaticResource {x:Type ScrollViewer}}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:ParallelScrollViewer}">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto"/>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="Auto"/>
						</Grid.ColumnDefinitions>

						<Grid.RowDefinitions>
							<RowDefinition Height="*"/>
							<RowDefinition Height="Auto"/>
						</Grid.RowDefinitions>

						<ContentPresenter Content="{TemplateBinding ParallelContent}"/>

						<ScrollContentPresenter
							Grid.Column="1"
							CanContentScroll="{TemplateBinding CanContentScroll}"
							/>

						<ScrollBar
							x:Name="PART_VerticalScrollBar"
							Grid.Column="2"
								Value="{TemplateBinding VerticalOffset}"
								Maximum="{TemplateBinding ScrollableHeight}"
								ViewportSize="{TemplateBinding ViewportHeight}"
								Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
						<ScrollBar x:Name="PART_HorizontalScrollBar"
								Orientation="Horizontal"
								Grid.Row="1"
								Grid.Column="1"
								Value="{TemplateBinding HorizontalOffset}"
								Maximum="{TemplateBinding ScrollableWidth}"
								ViewportSize="{TemplateBinding ViewportWidth}"
								Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:DiagramControl}" BasedOn="{StaticResource {x:Type ItemsControl}}">
		<Setter Property="Background" Value="CornflowerBlue"/>
		<Setter Property="ItemsPanel">
			<Setter.Value>
				<ItemsPanelTemplate>
					<l:DiagramPanel
						Background="CornflowerBlue"
						IsItemsHost="True"
						/>
				</ItemsPanelTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:DiagramControl}">
					<ScrollViewer
						VerticalScrollBarVisibility="Auto"
						HorizontalScrollBarVisibility="Auto"
						>
						<ItemsPresenter/>
					</ScrollViewer>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:DiagramItem}" BasedOn="{StaticResource {x:Type HeaderedContentControl}}">
		<Setter Property="Background" Value="White"/>
		<Setter Property="HeaderTemplate">
			<Setter.Value>
				<DataTemplate>
					<ContentPresenter/>
				</DataTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:DiagramItem}">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="6"/>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="6"/>
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition Height="6"/>
							<RowDefinition Height="*"/>
							<RowDefinition Height="6"/>
						</Grid.RowDefinitions>

						<Grid.Resources>
							<Style TargetType="{x:Type l:LayoutHandle}">
								<Setter Property="Template">
									<Setter.Value>
										<ControlTemplate TargetType="{x:Type l:LayoutHandle}">
											<ContentPresenter/>
										</ControlTemplate>
									</Setter.Value>
								</Setter>
							</Style>
						</Grid.Resources>

						<l:LayoutHandle Behavior="TopLeft">
							<Path
								Name="PART_TopLeft"
								Data="M1,0 A 1,1 90 0 0 0,1 L1,1 Z"
								Stretch="Fill"
								Fill="{TemplateBinding Background}"
								/>
						</l:LayoutHandle>

						<l:LayoutHandle Behavior="Top" Grid.Column="1">
							<Rectangle
								Grid.Column="1"
								Fill="{TemplateBinding Background}"
								Name="PART_Top"
								/>
						</l:LayoutHandle>
						<l:LayoutHandle Behavior="TopRight" Grid.Column="2">
							<Path
								Grid.Column="2"
								Name="PART_TopRight"
								Data="M1,1 A 1,1 90 0 0 0,0 L0,1 Z"
								Stretch="Fill"
								Fill="{TemplateBinding Background}"
								/>
						</l:LayoutHandle>

						<l:LayoutHandle Behavior="Left" Grid.Row="1">
							<Rectangle
								Grid.Row="1"
								Fill="{TemplateBinding Background}"
								Name="PART_Left"
								/>
						</l:LayoutHandle>
						<l:LayoutHandle Behavior="Right" Grid.Row="1" Grid.Column="2">
							<Rectangle
								Grid.Row="1"
								Grid.Column="2"
								Fill="{TemplateBinding Background}"
								Name="PART_Right"
								/>
						</l:LayoutHandle>

						<l:LayoutHandle Behavior="BottomLeft" Grid.Row="2">
							<Path
								Grid.Row="2"
								Data="M1,1 A 1,1 90 0 1 0,0 L1,0 Z"
								Stretch="Fill"
								Fill="{TemplateBinding Background}"
								Name="PART_BottomLeft"
								/>
						</l:LayoutHandle>
						<l:LayoutHandle Behavior="Bottom" Grid.Row="2" Grid.Column="1">
							<Rectangle
								Grid.Row="2"
								Grid.Column="1"
								Fill="{TemplateBinding Background}"
								Name="PART_Bottom"
								/>
						</l:LayoutHandle>
						<l:LayoutHandle Behavior="BottomRight" Grid.Row="2" Grid.Column="2">
							<Path
								Grid.Row="2"
								Grid.Column="2"
								Name="PART_BottomRight"
								Stretch="Fill"
								Data="M1,0 A 1,1 90 0 1 0,1 L0,0 Z"
								Fill="{TemplateBinding Background}"
								/>
						</l:LayoutHandle>

						<l:LayoutHandle Behavior="Move" Grid.Row="1" Grid.Column="1">
							<Grid
								Grid.Row="1"
								Grid.Column="1"
								Background="{TemplateBinding Background}"
								>
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto"/>
									<RowDefinition Height="*"/>
								</Grid.RowDefinitions>

								<!--<ContentPresenter ContentSource="Header"/>-->

								<ContentPresenter
									Grid.Row="1"
									/>
							</Grid>
						</l:LayoutHandle>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:Connector}">
		<Setter Property="Stroke">
			<Setter.Value>
				<Pen Brush="Black" Thickness="1"/>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:AutoCompleteBox}" BasedOn="{StaticResource {x:Type TextBox}}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:AutoCompleteBox}">
					<Grid>
						<ScrollViewer x:Name="PART_ContentHost"/>

						<Popup
							IsOpen="{Binding IsSuggestionListOpen, RelativeSource={x:Static RelativeSource.TemplatedParent}, Mode=OneWay}"
							PlacementTarget="{Binding ElementName=PART_ContentHost}"
							>
							<ListBox
								x:Name="PART_SuggestionList"
								ItemsSource="{TemplateBinding ItemsSource}"
								ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
								/>
						</Popup>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Style.Triggers>
			<Trigger Property="IsSuggestionListOpen" Value="True">
				<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
			</Trigger>
		</Style.Triggers>
	</Style>

	<Style TargetType="{x:Type l:PopupExpander}" BasedOn="{StaticResource {x:Type Expander}}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:PopupExpander}">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="Auto"/>
						</Grid.ColumnDefinitions>

						<ContentPresenter ContentSource="Header"/>

						<ToggleButton
							Grid.Column="1"
							Name="toggle"
							IsChecked="{TemplateBinding IsExpanded}"
							>
							<Path
								Width="7"
								Height="4"
								Fill="Black"
								Data="M0,0 L6,0 L3,3 Z"
								/>
						</ToggleButton>

						<Popup
							IsOpen="{Binding IsChecked, ElementName=toggle}"
							Style="{TemplateBinding PopupStyle}"
							>
							<ContentPresenter/>
						</Popup>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type l:LayoutHandle}" BasedOn="{StaticResource {x:Type ContentControl}}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:LayoutHandle}">
					<Border
						BorderBrush="{TemplateBinding Foreground}"
						BorderThickness="1"
						Background="{TemplateBinding Background}"
						Padding="2"
						>
						<ContentPresenter/>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Foreground" Value="Black"/>
		<Setter Property="Background" Value="LimeGreen"/>

		<Style.Triggers>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsTargetResizable" Value="True"/>
					<Condition Property="Behavior" Value="TopLeft"/>
				</MultiTrigger.Conditions>

				<Setter Property="Cursor" Value="SizeNWSE"/>
			</MultiTrigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsTargetResizable" Value="True"/>
					<Condition Property="Behavior" Value="Top"/>
				</MultiTrigger.Conditions>

				<Setter Property="Cursor" Value="SizeNS"/>
			</MultiTrigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsTargetResizable" Value="True"/>
					<Condition Property="Behavior" Value="TopRight"/>
				</MultiTrigger.Conditions>

				<Setter Property="Cursor" Value="SizeNESW"/>
			</MultiTrigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsTargetResizable" Value="True"/>
					<Condition Property="Behavior" Value="Left"/>
				</MultiTrigger.Conditions>

				<Setter Property="Cursor" Value="SizeWE"/>
			</MultiTrigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsTargetResizable" Value="True"/>
					<Condition Property="Behavior" Value="Right"/>
				</MultiTrigger.Conditions>

				<Setter Property="Cursor" Value="SizeWE"/>
			</MultiTrigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsTargetResizable" Value="True"/>
					<Condition Property="Behavior" Value="BottomLeft"/>
				</MultiTrigger.Conditions>

				<Setter Property="Cursor" Value="SizeNESW"/>
			</MultiTrigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsTargetResizable" Value="True"/>
					<Condition Property="Behavior" Value="Bottom"/>
				</MultiTrigger.Conditions>

				<Setter Property="Cursor" Value="SizeNS"/>
			</MultiTrigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsTargetResizable" Value="True"/>
					<Condition Property="Behavior" Value="BottomRight"/>
				</MultiTrigger.Conditions>

				<Setter Property="Cursor" Value="SizeNWSE"/>
			</MultiTrigger>

			<Trigger Property="Behavior" Value="Move">
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type l:LayoutHandle}">
							<ContentPresenter/>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Trigger>
		</Style.Triggers>
	</Style>

	<Style TargetType="{x:Type l:LayoutFrame}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:LayoutFrame}">
					<Grid>
						<l:LayoutHandle Behavior="Move">
							<Control.Template>
								<ControlTemplate TargetType="{x:Type l:LayoutHandle}">
									<Grid>
										<Rectangle
											Stroke="{TemplateBinding Background}"
											StrokeThickness="1"
											/>
										<Rectangle
											Stroke="{TemplateBinding Foreground}"
											StrokeThickness="1"
											StrokeDashArray="3 3"
											/>
										<Border Background="Transparent"/>
									</Grid>
								</ControlTemplate>
							</Control.Template>
						</l:LayoutHandle>

						<Grid>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="12"/>
								<ColumnDefinition Width="*"/>
								<ColumnDefinition Width="12"/>
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition Height="12"/>
								<RowDefinition Height="*"/>
								<RowDefinition Height="12"/>
							</Grid.RowDefinitions>

							<Grid.Resources>
								<Style TargetType="{x:Type l:LayoutHandle}">
									<Setter Property="HorizontalAlignment" Value="Center"/>
									<Setter Property="VerticalAlignment" Value="Center"/>
									<Setter Property="Width" Value="8"/>
									<Setter Property="Height" Value="8"/>
								</Style>
							</Grid.Resources>

							<l:LayoutHandle LayoutTarget="{TemplateBinding LayoutTarget}" Behavior="TopLeft">
								<UIElement.RenderTransform>
									<TranslateTransform X="-12" Y="-12"/>
								</UIElement.RenderTransform>
							</l:LayoutHandle>
							<l:LayoutHandle LayoutTarget="{TemplateBinding LayoutTarget}" Behavior="Top" Grid.Column="1">
								<UIElement.RenderTransform>
									<TranslateTransform Y="-12"/>
								</UIElement.RenderTransform>
							</l:LayoutHandle>

							<l:LayoutHandle LayoutTarget="{TemplateBinding LayoutTarget}" Behavior="TopRight" Grid.Column="2">
								<UIElement.RenderTransform>
									<TranslateTransform X="12" Y="-12"/>
								</UIElement.RenderTransform>
							</l:LayoutHandle>

							<l:LayoutHandle LayoutTarget="{TemplateBinding LayoutTarget}" Behavior="Left" Grid.Row="1">
								<UIElement.RenderTransform>
									<TranslateTransform X="-12"/>
								</UIElement.RenderTransform>
							</l:LayoutHandle>
							<l:LayoutHandle LayoutTarget="{TemplateBinding LayoutTarget}" Behavior="Right" Grid.Row="1" Grid.Column="2">
								<UIElement.RenderTransform>
									<TranslateTransform X="12"/>
								</UIElement.RenderTransform>
							</l:LayoutHandle>

							<l:LayoutHandle LayoutTarget="{TemplateBinding LayoutTarget}" Behavior="BottomLeft" Grid.Row="2">
								<UIElement.RenderTransform>
									<TranslateTransform X="-12" Y="12"/>
								</UIElement.RenderTransform>
							</l:LayoutHandle>
							<l:LayoutHandle LayoutTarget="{TemplateBinding LayoutTarget}" Behavior="Bottom" Grid.Row="2" Grid.Column="1">
								<UIElement.RenderTransform>
									<TranslateTransform Y="12"/>
								</UIElement.RenderTransform>
							</l:LayoutHandle>
							<l:LayoutHandle LayoutTarget="{TemplateBinding LayoutTarget}" Behavior="BottomRight" Grid.Row="2" Grid.Column="2">
								<UIElement.RenderTransform>
									<TranslateTransform X="12" Y="12"/>
								</UIElement.RenderTransform>
							</l:LayoutHandle>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style TargetType="{x:Type l:ColorChooser}">
		<Setter Property="Width" Value="300"/>
		<Setter Property="Height" Value="300"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:ColorChooser}">
					<ControlTemplate.Resources>
						<DataTemplate DataType="{x:Type l:ColorItem}">
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="Auto"/>
								</Grid.ColumnDefinitions>

								<Border
									CornerRadius="3"
									Margin="3"
									Width="16"
									Height="16"
									>
									<Border.Background>
										<SolidColorBrush Color="{Binding Color}"/>
									</Border.Background>
								</Border>

								<TextBlock
									Grid.Column="1"
									Text="{Binding Name}"
									/>
							</Grid>
						</DataTemplate>
					</ControlTemplate.Resources>

					<TabControl>
						<TabItem Header="Predefined">
							<ListBox
								ItemsSource="{TemplateBinding NamedColorItems}"
								SelectedItem="{Binding SelectedColorItem, RelativeSource={x:Static RelativeSource.TemplatedParent}}"
								/>
						</TabItem>
						<TabItem Header="System">
							<ListBox
								ItemsSource="{TemplateBinding SystemColorItems}"
								SelectedItem="{Binding SelectedColorItem, RelativeSource={x:Static RelativeSource.TemplatedParent}}"
								/>
						</TabItem>
						<TabItem Header="ARGB">
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="*"/>
									<ColumnDefinition Width="50"/>
								</Grid.ColumnDefinitions>
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto"/>
									<RowDefinition Height="Auto"/>
									<RowDefinition Height="Auto"/>
									<RowDefinition Height="Auto"/>
								</Grid.RowDefinitions>

								<TextBlock Text="Opacity"/>
								<Slider Grid.Column="1" Value="{Binding Opacity, RelativeSource={x:Static RelativeSource.TemplatedParent}}" Minimum="0" Maximum="255" Interval="1"/>
								<TextBox Grid.Column="2" Text="{Binding Opacity, RelativeSource={x:Static RelativeSource.TemplatedParent}}"/>

								<TextBlock Grid.Row="1" Text="Red"/>
								<Slider Grid.Row="1" Grid.Column="1" Value="{Binding RedValue, RelativeSource={x:Static RelativeSource.TemplatedParent}}" Minimum="0" Maximum="255" Interval="1"/>
								<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding RedValue, RelativeSource={x:Static RelativeSource.TemplatedParent}}"/>

								<TextBlock Grid.Row="2" Text="Green"/>
								<Slider Grid.Row="2" Grid.Column="1" Value="{Binding GreenValue, RelativeSource={x:Static RelativeSource.TemplatedParent}}" Minimum="0" Maximum="255" Interval="1"/>
								<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding GreenValue, RelativeSource={x:Static RelativeSource.TemplatedParent}}"/>

								<TextBlock Grid.Row="3" Text="Blue"/>
								<Slider Grid.Row="3" Grid.Column="1" Value="{Binding BlueValue, RelativeSource={x:Static RelativeSource.TemplatedParent}}" Minimum="0" Maximum="255" Interval="1"/>
								<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding BlueValue, RelativeSource={x:Static RelativeSource.TemplatedParent}}"/>
							</Grid>
						</TabItem>
					</TabControl>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style TargetType="{x:Type l:ColorPicker}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type l:ColorPicker}">
					<l:PopupExpander>
						<HeaderedContentControl.Header>
							<Border
								CornerRadius="3"
								Width="16"
								Height="16"
								>
								<Border.Background>
									<SolidColorBrush Color="{Binding Color, RelativeSource={x:Static RelativeSource.TemplatedParent}}"/>
								</Border.Background>
							</Border>
						</HeaderedContentControl.Header>

						<l:ColorChooser Color="{Binding Color, RelativeSource={x:Static RelativeSource.TemplatedParent}}" Width="300" Height="300"/>
					</l:PopupExpander>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<DataTemplate x:Key="{x:Static ui:WatermarkService.WatermarkTemplateKey}">
		<TextBlock
			Text="{Binding}"
			VerticalAlignment="Center"
			FontStyle="Oblique"
			Foreground="Gray"
			/>
	</DataTemplate>
	<Style TargetType="{x:Type l:WatermarkAdorner}">
		<Setter Property="ContentTemplate" Value="{DynamicResource {x:Static ui:WatermarkService.WatermarkTemplateKey}}"/>
		
	</Style>
</ResourceDictionary>